﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masterpage/CommonPage.master" AutoEventWireup="true" CodeFile="EditUser99XB.aspx.cs" Inherits="User_EditUser99XB" %>
<%@ Register TagPrefix="ta" Src="~/Controls/QuestionAttributeSelecor.ascx" TagName="CAS"  %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="pagenav"><b>您现在的位置：</b>我的管理平台 > <a href="<%=ResolveFilePath("User/ManagementUser.aspx")%>">用户信息管理</a> > <strong>修改用户信息</strong></div>
<div style="overflow:auto;">
    <!--paneltitle-->
    <div class="paneltitle">用户信息</div>
    <div class="paneladd">
         <input type="button" class="btn" value="返回" onclick="javascript:window.location.href = 'ManagementUser.aspx';this.blur();return false;" />
    </div>
</div>
<div  class="dataform">
	<table cellspacing="1" class="editortable">
	    <tr>
        	<td colspan="2" style="vertical-align:middle; font-weight:bold; padding-left:10px;" class="base">登录资料：</td>
        </tr>
	    <tr>
        	<th width="20%"><div>用户名：</div></th>
            <td class="editortd" width="80%">
    	        <asp:TextBox ID="txt_UserAccount" runat="server" Enabled="false" CssClass="txtBox" MaxLength="50" Width="150px" />&nbsp;<font color="red">*</font>    	        
    	        <span id="sp_UserAccount" style="display:none;" runat="server" class="note2"><img src="<%=ResolveThemeImagePath("iconinfo.gif")%>" align="absmiddle" />&nbsp;用户名不能为空</span>
    	        <span id="sp_UserAccount2" style="display:none;"  runat="server" class="note2"><img src="<%=ResolveThemeImagePath("iconinfo.gif")%>" align="absmiddle" />&nbsp;用户名已存在</span>
            </td>
        </tr>        
	    <tr>
        	<th width="20%"><div>学习卡号：</div></th>
            <td class="editortd" width="80%">
    	        <asp:TextBox ID="txtCardID" runat="server" CssClass="txtBox" MaxLength="50" Width="150px" />&nbsp;    	        
    	        <span id="spCardID" style="display:none;"  runat="server" class="note2"><img src="<%=ResolveThemeImagePath("iconinfo.gif")%>" align="absmiddle" />&nbsp;学习卡已存在</span>
            </td>
        </tr>        
        <tr>
        	<th><div>新密码：</div></th>
            <td>
    	        <asp:TextBox ID="txt_Password"  runat="server" CssClass="txtBox" MaxLength="50" Width="150px" />
    	        <span class="note1" id="sp_password5">密码至少8位字符,不填表示默认密码为12345678</span>    	        
    	       <span id="sp_Password4" style="display:none;"  runat="server" class="note2"><img src="<%=ResolveThemeImagePath("iconinfo.gif")%>" align="absmiddle" />&nbsp;密码必须至少8位字符</span>
    	        <span id="sp_Password2" style="display:none;"  runat="server" class="note2"><img src="<%=ResolveThemeImagePath("iconinfo.gif")%>" align="absmiddle" />&nbsp;两次密码输入不一致</span>
            </td>
        </tr>
        <tr>
        	<th><div>确认密码：</div></th>
            <td>
                <asp:TextBox ID="txt_Password2"  CssClass="txtBox" runat="server" MaxLength="50" Width="150px" />
                 <span id="sp_Password3" style="display:none;"  runat="server" class="note2"><img src="<%=ResolveThemeImagePath("iconinfo.gif")%>" align="absmiddle" />&nbsp;确认密码不能为空</span>
            </td>
        </tr>
        <tr class="editortr">
        	<th class="editorth"></th>
            <td class="editortd">
                <asp:Button Text="修改密码" runat="server" ID="btnModifyPwd" CssClass="btn" 
                    OnClientClick="javascript:return checkpwd();" onclick="btnModifyPwd_Click" />
            </td>
        </tr>
	    <%--<tr>
        	<td colspan="2" style="vertical-align:middle; font-weight:bold; padding-left:10px;" class="base">类别资料：</td>
        </tr>
        <tr class="editortr">
       	  	<th class="editorth" ><div>用户类型：</div></th>
        	<td class="editortd"  >
    	        <asp:DropDownList ID="ddlMemberType" Runat="server" Width="150px">
				    <asp:ListItem Text="普通用户" Value="1" Selected="True"></asp:ListItem>
				    <asp:ListItem Text="教师" Value="4"></asp:ListItem>
			    </asp:DropDownList>
    	    </td>    	
    	</tr>
        <tr class="editortr">
       	  	<th class="editorth" ><div>专业特长：</div></th>
        	<td class="editortd"  >
    	        <asp:TextBox ID="txtSpecialty" runat="server" CssClass="txtBox" MaxLength="2000" Width="500px" TextMode="MultiLine" Height="54px" />
    	    </td>    	
    	</tr>
        <tr class="editortr">
       	  	<th class="editorth" ><div>师资介绍：</div></th>
        	<td class="editortd"  >
    	        <asp:TextBox ID="txtMemo" runat="server" CssClass="txtBox" MaxLength="4000" Width="500px" TextMode="MultiLine" Height="108px" />
    	    </td>    	
    	</tr>--%>
        <tr class="editortr">
       	  	<th class="editorth" ><div>志愿者：</div></th>
        	<td class="editortd"  >
        	    <asp:CheckBox ID="chkIsVolunteer" Text="是否志愿者" runat="server" />
    	    </td>    	
    	</tr>

        <tr style="background-color:White">
        	<td colspan="2" style="vertical-align:middle; font-weight:bold; padding-left:10px;">详细资料：</td>
        </tr>
        <tr class="editortr">
       	  	<th class="editorth"><div>真实姓名：</div></th>
        	<td class="editortd">
    	        <asp:TextBox ID="txt_RealName" runat="server" CssClass="txtBox" MaxLength="50" Width="150px" />&nbsp;<font color="red">*</font>
    	        <span id="sp_Realname" style="display:none;"  runat="server" class="note2"><img src="<%=ResolveThemeImagePath("iconinfo.gif")%>" align="absmiddle" />&nbsp;真实姓名不能为空</span>
    	    </td>    	
    	</tr>
        <tr class="editortr">
       	  	<th class="editorth" ><div>昵称：</div></th>
        	<td class="editortd">
    	        <asp:TextBox ID="txt_NickName" runat="server" Enabled="false" CssClass="txtBox" MaxLength="50" Width="150px" />&nbsp;<font color="red">*</font>
    	        <span id="sp_Nickname" style="display:none;"  runat="server" class="note2"><img src="<%=ResolveThemeImagePath("iconinfo.gif")%>" align="absmiddle" />&nbsp;昵称不能为空</span>
    	    </td>    	
    	</tr>
    	<tr class="editortr">
       	  	<th class="editorth" ><div>VIP等级：</div></th>
        	<td class="editortd">
    	        <asp:TextBox ID="txtVip" runat="server" Enabled="false" CssClass="txtBox" MaxLength="50" Width="150px" />
    	        <asp:Button Text="升级" runat="server" ID="btnUpgradeVip" CssClass="btn" Visible="false" OnClientClick="javascript:return confirm('确定要手动升级吗？');" onclick="btnUpgradeVip_Click" />
    	    </td>    	
    	</tr>
        <tr class="editortr">
       	  	<th class="editorth" ><div>证件类型：</div></th>
        	<td class="editortd"  >
    	        <asp:DropDownList ID="ddl_CardType" Runat="server" Width="150px">
				    <asp:ListItem Text="身份证" Value="1" Selected="True">身份证</asp:ListItem>
				    <asp:ListItem Text="学生证" Value="2">学生证</asp:ListItem>
				    <asp:ListItem Text="护照" Value="3">护照</asp:ListItem>
				    <asp:ListItem Text="其它" Value="4">其它</asp:ListItem>
			    </asp:DropDownList>
    	    </td>    	
    	</tr>
        <tr class="editortr">
        	<th class="editorth"><div>证件号码：</div></th>
        	<td class="editortd"  >
    	        <asp:TextBox ID="txt_IDCard" runat="server" CssClass="txtBox" MaxLength="50" Width="150px" />
    	    </td> 
        </tr>
    	<tr class="editortr">
       	  	<th class="editorth" ><div>性别：</div></th>
        	<td class="editortd"  >
    	        <asp:DropDownList ID="ddl_Sex" Runat="server" Width="150px">
				    <asp:ListItem Text="男" Value="1">男</asp:ListItem>
				    <asp:ListItem Text="女" Value="2">女</asp:ListItem>
			    </asp:DropDownList>
    	    </td>    	
    	</tr>
        <tr class="editortr">
            <th class="editorth"><div>手机号码：</div></th>
            <td class="editortd">
                <asp:TextBox ID="txt_CellPhone" CssClass="txtBox" runat="server" MaxLength="50" Width="150px" />
    	        
            </td>
        </tr>
    	<tr class="editortr">
       	  	<th class="editorth" ><div>工作单位：</div></th>
        	<td class="editortd"  >
    	        <asp:TextBox ID="txt_Duty" runat="server" CssClass="txtBox" MaxLength="50" Width="150px" />
    	    </td>
    	</tr>
    	<tr>
            <th width="10%">
                工作地区：
            </th>
            <td style="width: 500px; color: Red;">
                <asp:DropDownList ID="ddl_WordAddress_Province" runat="server" Width="150px"></asp:DropDownList>
                <asp:DropDownList ID="ddl_WordAddress_City" runat="server" Width="150px"></asp:DropDownList>
                <asp:HiddenField runat="server" ID="hd_WordAddress_City" />
                <asp:DropDownList ID="ddl_WordAddress_Area" runat="server" Width="150px"></asp:DropDownList>
                <asp:HiddenField runat="server" ID="hd_WordAddress_Area" />
            </td>
        </tr>
        <tr>
            <th width="10%">
                生活地区：
            </th>
            <td style="width: 500px; color: Red;">
                <asp:DropDownList ID="ddl_HomeAddress_Province" runat="server" Width="150px"></asp:DropDownList>
                <asp:DropDownList ID="ddl_HomeAddress_City" runat="server" Width="150px"></asp:DropDownList>
                <asp:HiddenField runat="server" ID="hd_HomeAddress_City" />
                <asp:DropDownList ID="ddl_HomeAddress_Area" runat="server" Width="150px"></asp:DropDownList>
                <asp:HiddenField runat="server" ID="hd_HomeAddress_Area" />
            </td>
        </tr>
    	<tr class="editortr">
        	<th class="editorth"><div>E-Mail：</div></th>
            <td class="editortd">
                <asp:TextBox ID="txt_Email" CssClass="txtBox" runat="server" MaxLength="50" Width="150px" />
                <!--&nbsp;<font color="red">*</font><span id="sp_Email" style="display:none;"  runat="server" class="note2"><img src="<%=ResolveThemeImagePath("iconinfo.gif")%>" align="absmiddle" />&nbsp;E-Mail不能为空</span>-->
    	        <span id="sp_Email2" style="display:none;" runat="server" class="note2"><img src="<%=ResolveThemeImagePath("iconinfo.gif")%>" align="absmiddle" />&nbsp;E-Mail地址不合法</span>
    	        <span id="sp_Email3" style="display:none;"  runat="server" class="note2"><img src="<%=ResolveThemeImagePath("iconinfo.gif")%>" align="absmiddle" />&nbsp;E-Mail地址已存在</span>
            </td>
        </tr>
    	<tr class="editortr">
       	  	<th class="editorth" ><div>用户标签：</div></th>
        	<td class="editortd"  >
        	    <ta:CAS runat="server" ID="ta_Attributes" Width="500" Type="2" />
    	    </td>
    	</tr>
    	<tr class="editortr">
    	    <th class="editorth"><div>头像：</div></th>
            <td class="editortd">
                <asp:Image ID="img_Header" runat="server" /><br />
                <input id="File1" type="file" contenteditable="false" runat="server" style="width:280px"/>
                <span style="color:#999999">图片格式必须为.gif,.jpg,.jpeg,.png,大小不超过200KB</span>
            </td>
        </tr>
    	 <tr class="editortr">
        	<th class="editorth"><div>状态：</div></th>
            <td class="editortd">
                <asp:RadioButton ID="rbt_Y" Text="启用" GroupName="x" Checked="true" runat="server" />
                <asp:RadioButton ID="rbt_N" Text="停用" GroupName="x" runat="server" />
            </td>
        </tr>
        
        <tr class="editortr">
        	<th class="editorth"><div></div></th>
            <td class="editortd">
            <asp:Button Text=" 修 改 " runat="server" ID="btn_ModifyDetail" CssClass="btn" 
                    OnClientClick="javascript:return checkbasic();" onclick="btnModifyDetail_Click" />
                <input type="button" id="btn_EditDetail" style="display:none;" class="btn" value="修改补充信息"/>
            </td>
        </tr>
    </table>
</div>
<script type="text/javascript" language="javascript">
    jQuery(function() {
        jQuery("#<%= ddl_WordAddress_Province.ClientID %>").change(function() {
            var areaKey = jQuery(this).val();
            // 首先初始化
            jQuery("#<%= ddl_WordAddress_City.ClientID %>").empty().append(jQuery("<option></option>").val("0").html("  ---  请选择  ---  "));
            if (areaKey != 0) {
                sendData(2, areaKey, 1);
            }
        });
        jQuery("#<%= ddl_WordAddress_City.ClientID %>").change(function() {
            var areaKey = jQuery(this).val();
            // 首先初始化
            jQuery("#<%= ddl_WordAddress_Area.ClientID %>").empty().append(jQuery("<option></option>").val("0").html("  ---  请选择  ---  "));
            jQuery("#<%= hd_WordAddress_City.ClientID %>").val(areaKey);
            if (areaKey != 0) {
                sendData(3, areaKey, 2);
            }
        });
        jQuery("#<%= ddl_WordAddress_Area.ClientID %>").change(function() {
            jQuery("#<%= hd_WordAddress_Area.ClientID %>").val(jQuery(this).val());
        });

        jQuery("#<%= ddl_HomeAddress_Province.ClientID %>").change(function() {
            var areaKey = jQuery(this).val();
            // 首先初始化
            jQuery("#<%= ddl_HomeAddress_City.ClientID %>").empty().append(jQuery("<option></option>").val("0").html("  ---  请选择  ---  "));
            if (areaKey != 0) {
                sendData(2, areaKey, 3);
            }
        });
        jQuery("#<%= ddl_HomeAddress_City.ClientID %>").change(function() {
            var areaKey = jQuery(this).val();
            // 首先初始化
            jQuery("#<%= ddl_HomeAddress_Area.ClientID %>").empty().append(jQuery("<option></option>").val("0").html("  ---  请选择  ---  "));
            jQuery("#<%= hd_HomeAddress_City.ClientID %>").val(areaKey);
            if (areaKey != 0) {
                sendData(3, areaKey, 4);
            }
        });

        jQuery("#<%= ddl_HomeAddress_Area.ClientID %>").change(function() {
            jQuery("#<%= hd_HomeAddress_Area.ClientID %>").val(jQuery(this).val());
        });

    });
    function sendData(nodeType, areaKey, press) {
        var cmd = 'getcitylist';
        jQuery.ajax({
            type: "POST",
            url: "../api/Member.ashx",
            data: 'cmd=' + cmd + '&nodeType=' + nodeType + '&areaKey=' + areaKey,
            dataType: "json",
            success: function(data) {
                date = data;
                getddlList(data, press);
            },
            error: function() {
                alert("ajax请求发生错误");
            }

        });
    }
    function getddlList(data, press) {
        jQuery.each(data, function(i, item) {
            if (press == 1) {
                jQuery("#<%= ddl_WordAddress_City.ClientID %>").append(jQuery("<option></option").val(item.AreaId).html(item.AreaName));
            }
            else if (press == 2) {
                jQuery("#<%= ddl_WordAddress_Area.ClientID %>").append(jQuery("<option></option").val(item.AreaId).html(item.AreaName));
            }
            else if (press == 3) {
                jQuery("#<%= ddl_HomeAddress_City.ClientID %>").append(jQuery("<option></option").val(item.AreaId).html(item.AreaName));
            }
            else if (press == 4) {
                jQuery("#<%= ddl_HomeAddress_Area.ClientID %>").append(jQuery("<option></option").val(item.AreaId).html(item.AreaName));
            }
        });
    }
    function checkpwd() {
        var errorcount = 0;

        if ($F("<%=txt_Password.ClientID%>").strip() != "" && $F("<%=txt_Password.ClientID%>").strip().length < 8) {
            errorcount += 1;
            if ($("<%=sp_Password4.ClientID%>")) {
                $("<%=sp_Password4.ClientID%>").style.display = "inline";
            }
        }
        else {
            if ($("<%=sp_Password4.ClientID%>")) {
                $("<%=sp_Password4.ClientID%>").style.display = "none";
            }

        }

        if ($F("<%=txt_Password.ClientID%>").strip() != "" && $F("<%=txt_Password2.ClientID%>").strip().length <= 0) {
            errorcount += 1;
            if ($("<%=sp_Password3.ClientID%>")) {
                $("<%=sp_Password3.ClientID%>").style.display = "inline";
            }
        }
        else {
            if ($("<%=sp_Password3.ClientID%>")) {
                $("<%=sp_Password3.ClientID%>").style.display = "none";
            }
            if ($F("<%= txt_Password2.ClientID%>").strip() != $F("<%=txt_Password.ClientID%>").strip()) {
                errorcount += 1;
                if ($("<%=sp_Password2.ClientID%>")) {
                    $("<%=sp_Password2.ClientID%>").style.display = "inline";
                }
            }
            else {
                if ($("<%=sp_Password2.ClientID%>")) {
                    $("<%=sp_Password2.ClientID%>").style.display = "none";
                }
            }
        }

        if (errorcount > 0) {
            return false;
        }
        else {
            return true;
        }
    }
    function checkbasic() {
        var errorcount = 0;

        if ($F("<%=txt_UserAccount.ClientID%>").strip().length <= 0) {
            $("<%=sp_UserAccount.ClientID%>").style.display = "inline";
            errorcount += 1;
        }
        else {
            $("<%=sp_UserAccount.ClientID%>").style.display = "none";
        }


        if ($F("<%=txt_RealName.ClientID%>").strip().length <= 0) {
            errorcount += 1;
            if ($("<%=sp_Realname.ClientID%>")) {
                $("<%=sp_Realname.ClientID%>").style.display = "inline";
            }
        }
        else {
            if ($("<%=sp_Realname.ClientID%>")) {
                $("<%=sp_Realname.ClientID%>").style.display = "none";
            }
        }
        if ($F("<%=txt_NickName.ClientID%>").strip().length <= 0) {
            errorcount += 1;
            if ($("<%=sp_Nickname.ClientID%>")) {
                $("<%= sp_Nickname.ClientID%>").style.display = "inline";
            }
        }
        else {
            if ($("<%=sp_Nickname.ClientID%>")) {
                $("<%= sp_Nickname.ClientID%>").style.display = "none";
            }
        }
        if ($F("<%=txt_Email.ClientID%>").strip().length > 0) {
            var reg = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
            if (!reg.test($F("<%=txt_Email.ClientID%>"))) {
                errorcount += 1;
                if ($("<%= sp_Email2.ClientID%>")) {
                    $("<%= sp_Email2.ClientID%>").style.display = "inline";
                }
            }
            else {
                if ($("<%= sp_Email2.ClientID%>")) {
                    $("<%= sp_Email2.ClientID%>").style.display = "none";
                }
            }
        }



        if (errorcount > 0) {
            return false;
        }
        else {
            return true;
        }
    }

</script>
</asp:Content>

